from django.shortcuts import render, redirect
from app01.models import User
from app01.utils.form import UserEditModelForm

# Create your views here.


def edit(request):
    coo = request.session.get('info', "")
    form = UserEditModelForm()
    if request.method == 'GET':
        return render(request, "edit/edit.html", {"form": form, "coo": coo})
    form = UserEditModelForm(data=request.POST)
    User.objects.filter(email=request.POST.get("email"))
    if form.is_valid():
        return redirect("/login/")
    else:
        return render(request, "edit/edit.html", {"form": form, "coo": coo})